feat(themes): Add themed SVG fallbacks for API error responses#8253
Conversation
|
@Rakshak05 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
This pull request introduces themed SVG fallbacks for API errors, improving the visual consistency of error messages with user-selected themes. This aligns with previous decisions made to enhance theme rendering based on user preferences, ensuring a smoother user experience. Thank you for your contribution, and I look forward to your updates! |
95fbc74 to
00e8dbe
Compare
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
Aamod007
left a comment
There was a problem hiding this comment.
This is a brilliant architectural refactor! Returning an inline error SVG dynamically instead of raw JSON on API errors ensures that users' README badges degrade gracefully rather than displaying broken images. The integration of
esolveErrorTheme\ ensures these fallbacks still match the requested aesthetic. The rollout across all major APIs is very well executed.
Incredible work!
Label Justification:
- \level:critical: Assigned based on 10 files changed across multiple major API routes, introducing a new paradigm for SVG error rendering.
- \quality:clean: Excellent unit test coverage for the theme resolver and clean fallback logic.
- \ ype:refactor: Refactors error handling in API routes from returning JSON to returning dynamic SVGs.
- \mentor:Aamod007: Assigned as required.
|
🎉 Congratulations @Rakshak05! Your PR has been successfully merged. 🚀 Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.
Keep building! 💻✨ |
Description
Fixes #7796
Pillar
Visual Preview
Previously, when hitting API rate limits or facing validation errors, CommitPulse returned a generic
#2d0000(red) SVG error box which looked out of place on beautifully themed GitHub Profile READMEs.With this PR:
theme, custombg,accent,text, etc.) usingresolveErrorTheme.buildInlineErrorSVGcontaining the appropriate border radius, background, text, and accent borders./api/spotify,/api/spotlight,/api/streak,/api/wakatime, and/api/wrapped.Example theme response when requesting
theme=dracula:Checklist before requesting a review:
CONTRIBUTING.mdfile.localhost:3000/api/streak?user=YOUR_USERNAME).npm run formatandnpm run lintlocally and resolved all errors (CI will fail otherwise).feat(themes): ...,fix(calculate): ...).README.mdif I added a new theme or URL parameter.